/*全屏添加或编辑*/
function edit(title, url) {
    var index = layer.open({
        type: 2,
        title: title,
        content: url
    });
    layer.full(index);
}

/*小屏-添加*/
function m_edit(title, url, w, h) {
    layer_show(title, url, w, h);
}

/*删除*/
function del(id, url) {
    layer.confirm('确定删除？', function (index) {
        location.href = url
    })
}

/*时间*/
function selecttime(flag){

    if(flag==1){
        var endTime = $("#countTimeend").val();
        if(endTime != ""){
            WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:endTime})}else{
            WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})}
    }else{
        var startTime = $("#countTimestart").val();
        if(startTime != ""){
            WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:startTime})}else{
            WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})}
    }
}



/**
 * 排序
 * @param obj
 * @param id
 */
function change(url,obj, id) {
    $.post(url, {id: id, sort: $(obj).val()}, function (res) {
        location.reload()
    }, 'json')
}

/**
 * 提交
 * @param url
 * @param id
 */
function tijiao(url, id) {
    $.post(url, {id: id}, function (res) {
        location.reload()
    }, 'json')
}

/**
 * 处理ajax提交的数据
 * @param data
 */
function ajax_chuli(data){
    if(data.status=="y"){
        layer.confirm('继续发布？', {
            btn: ['是的','关闭'] //按钮
        }, function(){
            window.location.reload();
        }, function(){
            window.parent.location.reload();
            layer_close();
        });
    }
    if(data.status=="u"){
        setTimeout(function () {
            window.parent.location.reload();
            layer_close();
        }, 1000);
    }
}